package com.etrans.web.gps.business.base.controller;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.etrans.web.gps.base.controller.BaseController;
import com.etrans.web.gps.business.base.service.NotifyRecoreService;

@Controller
@RequestMapping("/base/notifyRecore/*")
public class NotifyRecoreController extends BaseController{
	
	@Autowired
	private NotifyRecoreService  notifyRecoreService;

	@RequestMapping(value = "saveNotifyRecore.html")
	@ResponseBody
	public Map<String,Object> saveNotifyRecore(Integer notifyObj, Integer notifyId, Integer notifyType, String notifyCont) {
		int userId = getSysUser().getId();
		Map<String,Object> map = new HashMap<String,Object>();
		HashMap<String, Object> param=new HashMap<>();
		param.put("notifyObj", notifyObj);
		param.put("notifyId", notifyId);
		param.put("notifyType", notifyType);
		param.put("notifyCont", notifyCont);
		param.put("userId", userId);
		if(notifyRecoreService.saveNotifyRecore(param)){
			map.put("code",0);
			map.put("msg","添加成功");
		}else {
			map.put("code",1);
			map.put("msg","添加失败");
		}
		return map;
	}
	
	@RequestMapping(value = "queryAllDriver.html")
	@ResponseBody
	public List<Map<String,Object>> queryAllDriver(String name) {
		HashMap<String, Object> param=new HashMap<>();
		param.put("driver_name", name);
		return notifyRecoreService.queryAllDriver(param);
	}
	
	@RequestMapping(value = "queryAllEnterprise.html")
	@ResponseBody
	public List<Map<String,Object>> queryAllEnterprise(String name) {
		HashMap<String, Object> param=new HashMap<>();
		param.put("enterprise_name", name);
		return notifyRecoreService.queryAllEnterprise(param);
	}
}
